<script setup>
import Demo09Form03Children01 from './demo09-form03-children01.vue';
</script>
<template>
<zhtt-card title="自动获取焦点">
  <input type="text" class="zhtt-input" ref="input">
</zhtt-card>
  <zhtt-card title="子组件自动获取焦点">
    this.$refs.myinput.focusInput()
    <Demo09Form03Children01 ref="myinput"></Demo09Form03Children01>
  </zhtt-card>
</template>

<script>
export default {
  name: "demo09-from03-forcus",
  methods:{
    focusInput(){
      this.$refs.input.focus();
      setTimeout(()=>{
        this.$refs.myinput.focusInput()
      },1500);
    }
  },
  mounted() {
    this.focusInput();
  }
}
</script>

<style scoped>

</style>